<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://unpkg.com/vue@next"></script>

    <div id="app">
        <todo-item user="kenny.bai"></todo-item>
    </div>

    <script>
        const vueOpt = {
            data(){
                return {

                }
            }
        }

        const vm = Vue.createApp(vueOpt);
        vm.component('todo-item', {
            setup(props){
                console.log(props);
                // 这里返回的任何内容可以用于组件的其余部分
                return {a:1}
            },

            data(){
                return {

                }
            },

            props:{
                user:{
                    type: String,
                    required: true
                }
            },

            template: `
                <div>{{user}}</div>
                <div>{{a}}</div>
            `
        });
        vm.mount('#app');
    </script>
</body>
</html>